#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QStackedWidget>

// 提前声明各个页面类
class LoginPage;
class HomePage;
class SettingsPage;

class MaterialAccess;
class Personal;

class MaterialDetail;
class UserManagement;
class LogDetail;
class WarehousePermission;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    //登录成功槽函数
    void slotLoginSuccess();

    // 切换到对应页面的槽函数
    void showHomePage();
    void showSettingsPage();

    void showPersonal();
    void showMaterialAccess();

    void showMaterialManagement();
    void showUserManagement();
    void showLogDetail();
    void showWarehousePermission();

private:
    // 创建用户登录菜单栏
    void createMenusUser();
    //创建管理员登录菜单栏
    void createMenusManager();

    QMenu *currentSelectedMenu = nullptr;   // 当前展开的菜单（蓝色）
    QAction *currentSelectedAction = nullptr; // 当前选中的菜单动作

    // 页面容器
    QStackedWidget *stackedWidget;

    // 各个页面的指针
    HomePage *homePage;
    SettingsPage *settingsPage;

    Personal *personal;
    MaterialAccess *materialAccess;

    UserManagement *userManagement;
    MaterialDetail *materialDetail;
    LogDetail *logDetail;
    WarehousePermission *warehousePermission;
};

#endif // MAINWINDOW_H
